Class HCC.DT.HCC2HL72.EncCardUpdRequst Extends Ens.DataTransformDTL [ DependsOn = (EnsLib.EDI.XML.Document, EnsLib.HL7.Message) ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='EnsLib.EDI.XML.Document' targetClass='EnsLib.HL7.Message' sourceDocType='PRPA_IN201314UV02:PRPA_IN201314UV02' targetDocType='2.5.1:ADT_A01' create='new' language='objectscript' >
<assign value='source.{id().extension}' property='target.{MSH:MessageControlID}' action='set' />
<assign value='source.{creationTime().value}' property='target.{MSH:DateTimeOfMessage.Time}' action='set' />
<assign value='"ADT"' property='target.{MSH:MessageType.MessageCode}' action='set' />
<assign value='"A01"' property='target.{MSH:MessageType.TriggerEvent}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).registrationRequest(1).subject1(1).patient(1).id(1).item(1).extension}' property='target.{PID:PatientID.IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().effectiveTime.any.value}' property='target.{PID:PatientID.EffectiveDate}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().id.item().extension}' property='target.{PID:PatientIdentifierList(1).IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().idCategory.displayName.value}' property='target.{PID:PatientIdentifierList(1).IdentifierTypeCode}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().name()})' property='target.{PID:PatientName(1)}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().telecom},"//s:item/@value")' property='target.{PID:PhoneNumberHome(1)}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().administrativeGenderCode.displayName.value}' property='target.{PID:AdministrativeSex}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().maritalStatusCode.displayName.value}' property='target.{PID:MaritalStatus.Text}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().ethnicGroupCode.item().displayName.value}' property='target.{PID:EthnicGroup(1)}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().birthTime.value}' property='target.{PID:DateTimeofBirth.Time}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().asEmployee().employerOrganization().contactParty().telecom},"//s:item/@value")' property='target.{PID:PhoneNumberBusiness(1)}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().addr},"//s:item/s:part/@value")' property='target.{PID:PatientAddress(1)}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().asEmployee().employerOrganization().name},"//s:item/s:part/@value")' property='target.{ROL(1):OrganizationUnitType.Text}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().asEmployee().occupationCode.code}' property='target.{ROL():RoleROL.Identifier}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().asEmployee().occupationCode.displayName.value}' property='target.{ROL():RoleROL.Text}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().personalRelationship().code().displayName.value}' property='target.{NK1(1):Relationship.Text}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().personalRelationship().telecom},"//s:item/@value")' property='target.{NK1():PhoneNumber(1).TelephoneNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().personalRelationship().choice.relationshipHolder1().name},"//s:item/s:part/@value")' property='target.{NK1():Name(1)}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().coveredPartyOf().coverageRecord().beneficiary.choice.beneficiary().code.displayName.value}' property='target.{IN1grp(1).IN1:CoordinationOfBenefits}' action='set' />
<foreach property='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().asOtherIDs()}' key='k1' >
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().asOtherIDs(k1).id().item().extension}' property='target.{PID:AlternatePatientIDPID(k1).IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().choice.patientPerson().asOtherIDs(k1).scopingOrganization.id().item().extension}' property='target.{PID:AlternatePatientIDPID(k1).AssigningFacility.NamespaceID}' action='set' />
</foreach>
<assign value='source.{controlActProcess().subject().registrationRequest().author().assignedEntity().id().item().extension}' property='target.{EVN:OperatorID(1).IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().registrationRequest().author().assignedEntity().choice.assignedPerson.name()},"//s:item/s:part/@value")' property='target.{EVN:OperatorID(1).FamilyName}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().registrationRequest().subject1().patient().providerOrganization().name}, "//s:item/s:part/@value")' property='target.{PV1:ServicingFacility}' action='set' />
<assign value='source.{controlActProcess().subject().registrationRequest().subject1().patient().providerOrganization().id().item().extension}' property='target.{PV1:OtherHealthcareProvider(1).IDNumber}' action='set' />
</transform>
}

}
